package org.bees.cms.service.bean.furnish;

import java.util.List;

import javax.persistence.EntityManager;

import org.bees.cms.core.furnish.Furnish;
import org.bees.cms.service.bean.NamedServiceSupport;
import org.bees.cms.service.bean.ServiceSupport;
import org.bees.cms.service.furnish.FurnishService;

public abstract class FurnishServiceSupport<T extends Furnish> extends ServiceSupport<T> implements FurnishService<T> {
	protected NamedServiceBean namedServiceBean = new NamedServiceBean();

	@Override
	public T findByName(String name) throws Exception {
		return namedServiceBean.findByName(name);
	}

	@Override
	public List<T> listByName(String name) throws Exception {
		return namedServiceBean.listByName(name);
	}

	protected class NamedServiceBean extends NamedServiceSupport<T> {

		@Override
		protected EntityManager manager() {
			return manager;
		}

		@Override
		protected Class<T> parameter() {
			return parameter;
		}

	}

}
